package com.zhhs.galaxyott.activity;

import android.widget.ImageView;

import com.android.volley.VolleyError;
import com.bumptech.glide.Glide;
import com.zhhs.galaxyott.R;
import com.zhhs.galaxyott.http.api.RequestMaker;
import com.zhhs.galaxyott.httpVolley.base.ResponseListener;
import com.zhhs.galaxyott.httpVolley.response.SingleSpeciaResponse;
import com.zhhs.galaxyott.utils.Logs;

public class SingleSpecialActivity extends BaseActivity {

    private static String TAG = SingleSpecialActivity.class.getSimpleName();

    private ImageView type_img;
    private ImageView mSpecialIv;

    private int specailId;

    @Override
    protected void onCreateView() {
        setContentView(R.layout.activity_single_special);

        specailId = getIntent().getIntExtra("specailId", 0);

        type_img = (ImageView) findViewById(R.id.type_img);
        type_img.setBackgroundResource(R.drawable.activity_img);

        initView();
        loadData();
    }

    private void initView() {
        mSpecialIv = (ImageView) findViewById(R.id.iv_special);
    }

    private void loadData() {
        // int id = specailId;

        RequestMaker.getSingleSpecial(this, specailId, new ResponseListener<SingleSpeciaResponse>() {

            @Override
            public void onResponse(SingleSpeciaResponse result) {

                if (result.bean == null) {
                    return;
                }

                Logs.logD("DEBUG_DT", "this is getSingleSpecial-->" + result.errCode + result.bean.getImageUrl() + "id"
                        + specailId);
                if (result.errCode == 0) {
                    Glide.with(SingleSpecialActivity.this).load(result.bean.getImageUrl())
                            .placeholder(R.drawable.hot_movie_big_def).crossFade().into(mSpecialIv);
                }

            }

            @Override
            public void onError(VolleyError error) {
                Logs.logD("DEBUG_DT", "this is getSingleSpecial-->ERR");

            }
        });
    }
}
